home *** CD-ROM | disk | FTP | other *** search
- <?php
- // $Id: page.module,v 1.132 2005/02/08 19:44:39 dries Exp $
-
- /**
- * @file
- * Enables the creation of pages that can be added to the navigation system.
- */
-
- /**
- * Implementation of hook_help().
- */
- function page_help($section) {
- switch ($section) {
- case 'admin/modules#description':
- return t('Enables the creation of pages that can be added to the navigation system.');
- case 'node/add#page':
- return t('If you want to add a static page, like a contact page or an about page, use a page.');
- }
- }
-
- /**
- * Implementation of hook_perm().
- */
- function page_perm() {
- return array('create pages', 'edit own pages');
- }
-
- /**
- * Implementation of hook_node_name().
- */
- function page_node_name($node) {
- return t('page');
- }
-
- /**
- * Implementation of hook_access().
- */
- function page_access($op, $node) {
- global $user;
-
- if ($op == 'create') {
- return user_access('create pages');
- }
-
- if ($op == 'update' || $op == 'delete') {
- if (user_access('edit own pages') && ($user->uid == $node->uid)) {
- return TRUE;
- }
- }
- }
-
- /**
- * Implementation of hook_menu().
- */
- function page_menu($may_cache) {
- $items = array();
-
- if ($may_cache) {
- $items[] = array('path' => 'node/add/page', 'title' => t('page'),
- 'access' => page_access('create', NULL));
- }
-
- return $items;
- }
-
- /**
- * Implementation of hook_form().
- */
- function page_form(&$node) {
- if (function_exists('taxonomy_node_form')) {
- $output .= implode('', taxonomy_node_form('page', $node));
- }
-
- $output .= form_textarea(t('Body'), 'body', $node->body, 60, 20, '', NULL, TRUE);
- $output .= filter_form('format', $node->format);
-
- return $output;
- }
-
- ?>
-